package com.eascs.web.o2o.web.service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.eascs.web.o2o.web.common.BaseSevice;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;
import com.eascs.web.o2o.web.dao.BiodsDao;
import jodd.util.StringUtil;

@Service
public class O2oStatisticsService extends BaseSevice {
	
		
	@Autowired
	BiodsDao biodsDao;
		
	
	/**
	 * @Description:
	 *               <p>
	 *               loan-11722 增加业务汇总统计功能
	 *               </p>
	 * @author CXW
	 * @date 2017年6月23日 下午1:57:29
	 * @version V1.0
	 */
	public PageResult<Object[]> findLoanApplyStatis() {
		SqlPageQuery<Object[]> pageQuery = new SqlPageQuery<>(Object[].class, Integer.MAX_VALUE, 0);
		String querySql = "SELECT * from ods_o2oservice_loanapply_statistics ORDER BY total_sum desc";
		pageQuery.setSumColumnIndexs(new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18});
		pageQuery.setQuerySql(querySql);
		return biodsDao.findDataWithPage(pageQuery);
	}
	/**
	 * @Description:
	 *               <p>
	 *               loan-11722 增加业务汇总统计功能导出
	 *               </p>
	 * @author CXW
	 * @date 2017年6月23日 下午1:57:29
	 * @version V1.0
	 */
	public PageResult<Object[]> findLoanApplyStatiseExcel() {
		SqlPageQuery<Object[]> pageQuery = new SqlPageQuery<>(Object[].class, Integer.MAX_VALUE, 0);
		String querySql = "SELECT regional_name,new_count,new_sum,z_count,z_sum,zf_count,zf_sum,n_count,n_sum,nf_count,nf_sum,s_count,s_sum,total_count,total_sum,m_count,m_sum,y_count,y_sum  from ods_o2oservice_loanapply_statistics ORDER BY total_sum desc";
		pageQuery.setSumColumnIndexs(new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18});
		pageQuery.setQuerySql(querySql);
		return biodsDao.findDataWithPage(pageQuery);
	}
	
	
}
